<template>
  <view class="articleDetail">
    <view class="content">
      <h1>{{ content.title }}</h1>
      <text class="time">{{ (content.createtime || 0) | formatDate }}</text>
      <image
        class="img"
        :src="img + content.cover_image"
        mode="widthFix"
      />
      <view class="text" v-html="content.content"></view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      id: "",
      content: "",
      img:"https://www.123qifu.com/"
    };
  },
  onLoad(e) {
    this.id = e.id;
    if (this.id) {
      this.getDetail();
    }
  },
  methods: {
    // 获取精选好文详情
    async getDetail() {
      const res = await this.$myRequest({
        url: "index/essayDetail",
        method: "POST",
        data: {
          id: this.id,
        },
      });
      this.content = res.data.data;
    },
  },
};
</script>

<style lang="scss" scoped>
page {
  width: 750rpx;
  background-color: #f4f4f4;
}
.articleDetail {
    border-top: 20rpx solid #f4f4f4;
  .content {
    min-height: calc(100vh - 108rpx);
    background: #fff;
    box-sizing: border-box;
    overflow: hidden;
    padding: 0 25rpx;
    h1 {
      text-align: center;
      font-size: 34rpx;
      font-weight: 500;
      color: #333333;
      margin-top: 40rpx;
    }
    .time {
      display: block;
      text-align: center;
      font-size: 26rpx;
      font-weight: 400;
      color: #999999;
      margin-top: 20rpx;
    }
    .img {
      display: block;
      margin: 39rpx auto 0;
    }
    .text {
      margin-top: 37rpx;
      text-align: justify;
      box-sizing: border-box;
      padding: 0 30rpx;
      margin-bottom: 50rpx;
    }
  }
}
</style>
